﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Besture.Bll;
using Besture.Model;

namespace Besture.UI.Admin.Control
{
    public partial class SelectBrand : System.Web.UI.UserControl
    {
        public HotelsCategoryModel _LineModel = null;

        /// <summary>
        /// 选中产品类别
        /// </summary>
        public string selectClassID
        {
            get { return txtClassID.Text; }
            set { txtClassID.Text = value; }
        }

        /// <summary>
        /// 是否必须选择
        /// </summary>
        public bool Required { get; set; }
        /// <summary>
        /// 必须选择图片
        /// </summary>
        public string RequiredImageUrl = "/admin/Themes/images/dispensable.png";

        public bool NeedTopLevel { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //必须选择
                if (Required)
                {
                    RequiredImageUrl = "/admin/Themes/images/indispensable.gif";
                    txtClassID.CssClass = "SelectProductClass_SelectClassID required";
                }
            }
            if (!string.IsNullOrEmpty(selectClassID) && !selectClassID.Equals("0"))
            {
                HotelsCategoryDac LineDac = new HotelsCategoryDac();
                _LineModel = LineDac.GetModel(Convert.ToInt32(selectClassID));
            }
            else
            {
                _LineModel = new HotelsCategoryModel();
                _LineModel.CategoryName = "选择品牌";
            }
        }
    }
}